/* 
使用格式:
	1.引入公用样式表
	2.引入当前样式表
	3.引入公用js模块
	4.具体功能

*/

// 1.引入公用样式表
require("../../assets/css/index.less");

// 2.引入当前样式表
require("./coures.less");
let https = require("../../utils/https.js");
// 3.引入公用js模块
let dom = require("../../utils/dom.js");
require("../../assets/fonts/iconfont.css");

dom.ready(function () {
	dom.contFooter("sport");

	function getCourdeList() {
		https.get("/api/train/courseList", function (res) {
			console.log(res);
			if (res.errno == 0) {
				res.data.map((v) => {
					console.log(v);
					if (v.courseId == 1) {
						dom.getEle("#newCourseList").innerHTML += `
                        <li>
                            <a href="introduce.html?id=${v.courseId}">
                                <img src="${https.BASE_URL + v.imgurl}" alt="">
                                <div class="p5">
                                    <h2 class="f14">${v.name}</h2>
                                    <p>${v.desc}</p>
                                </div>
                            </a>
                        </li>`;
					} else {
						dom.getEle(".courseList").innerHTML += `
                        <li class="rel" data-id="${
													v.courseId
												}><a href="introduce.html?id=${v.courseId}">
					<img src="${https.BASE_URL + v.imgurl}" alt="" />
					<div class="abs">
						<h4>${v.name}</h4>
						<p>${v.desc}</p>
					</div> </a>
				</li>`;
					}
				});
			}
		});
	}
	getCourdeList();
});
